﻿using MediatR;
using SheepStorage.API.Application.Command.SheepRecordCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Application.CommandHandlers.SheepRecordHandlers
{
    public class UpdateSheepRecordBreedStateCommandHandler : IRequestHandler<UpdateSheepRecordBreedStateCommand, Results<int>>
    {
        ISheepRecordService _res;

        public UpdateSheepRecordBreedStateCommandHandler(ISheepRecordService res)
        {
            _res = res;
        }

        public async Task<Results<int>> Handle(UpdateSheepRecordBreedStateCommand request, CancellationToken cancellationToken)
        {
            var list =await _res.UpdateSheepRecordBreedState(request.OverBitTolist, request.state);
            return Results<int>.DataResult(list);
        }
    }
}
